package com.taint.asm.core;

import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.Analyzer;
import org.objectweb.asm.tree.analysis.AnalyzerException;
import org.objectweb.asm.tree.analysis.Frame;
import org.objectweb.asm.tree.analysis.Value;

public class ControlFlowAnaylzer extends Analyzer<Value> {
    private DataFlowInterpreter dataFlowInterpreter;
    private MethodNode methodNode;
    private InsnList insnList;
    private AbstractInsnNode insnNode;

    public ControlFlowAnaylzer(DataFlowInterpreter dataFlowInterpreter) {
        super(dataFlowInterpreter);
        this.dataFlowInterpreter = dataFlowInterpreter;
    }

    @Override
    public Frame<Value>[] analyze(String owner, MethodNode method) throws AnalyzerException {
        //这里分析的目的是啥
        this.methodNode = method;
        insnList=this.methodNode.instructions;
        return super.analyze(owner, method);
    }

    @Override
    protected void newControlFlowEdge(int insnIndex, int successorIndex) {
        //这里是添加数据流的关系
        //controlFlow.add(insnIndex, successorIndex);
        insnNode=insnList.get(insnIndex);

       switch (insnNode.getOpcode()){


       }
        super.newControlFlowEdge(insnIndex, successorIndex);
    }
}
